import axios from 'axios'

function getCinemaMovie (list, city, id) {
  let now = new Date()
  let year = now.getFullYear() // 年
  let month = now.getMonth() + 1 // 月
  let day = now.getDate() >10 ? now.getDate() : '0' + now.getDate()  // 日
  let formData = new FormData()
  let timer = (Number(new Date().getTime()) + Math.floor(Math.random()*50)).toString();
 
  formData.append('movieId', id)
  formData.append('day', `${year + '-' + month + '-' + day}`)
  formData.append('offset', list.offset)
  formData.append('limit', list.limit)
  formData.append('districtId', list.districtId)
  formData.append('lineId', list.lineId)
  formData.append('hallType', list.hallTypeId)
  formData.append('brandId', list.brandId)
  formData.append('serviceId', list.serviceId)
  formData.append('areaId', list.areaId)
  formData.append('stationId', list.stationId)

  formData.append('item', '')
  formData.append('updateShowDay', list.updateShowDay)
  formData.append('reqId', new Date().getTime())
  formData.append('cityId', city.id)
  return axios({
    method: 'post',
    url: `/ajax/movie?forceUpdate=` + timer,
    headers:
     {
       'X-Requested-With': 'XMLHttpRequest',
       'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
     },
    data: formData
  })
}
export default getCinemaMovie
